import {
  IpcClearPackage,
  IpcCloseLogcat,
  IpcConnectDevice,
  IpcCreateDir,
  IpcCreateShell,
  IpcDeleteDir,
  IpcDeleteFile,
  IpcDisablePackage,
  IpcDisconnectDevice,
  IpcDumpWindowHierarchy,
  IpcEnablePackage,
  IpcForward,
  IpcGetAvds,
  IpcGetDevices,
  IpcGetFileUrl,
  IpcGetFps,
  IpcGetPackageInfos,
  IpcGetPackages,
  IpcGetProcesses,
  IpcGetTopPackage,
  IpcGetWebviews,
  IpcInputKey,
  IpcInstallPackage,
  IpcKillShell,
  IpcListForwards,
  IpcListReverses,
  IpcMoveFile,
  IpcOpenFile,
  IpcOpenLogcat,
  IpcPairDevice,
  IpcPauseLogcat,
  IpcPullFile,
  IpcPushFile,
  IpcReadDir,
  IpcResizeShell,
  IpcResumeLogcat,
  IpcReverse,
  IpcReverseTcp,
  IpcScreencap,
  IpcSetScreencastAlwaysOnTop,
  IpcStartAvd,
  IpcStartPackage,
  IpcStartScrcpy,
  IpcStatFile,
  IpcStopAvd,
  IpcStopPackage,
  IpcUninstallPackage,
  IpcWipeAvdData,
  IpcWriteShell,
} from 'common/types'
import { IpcGetStore, IpcSetStore } from 'share/common/types'
import mainObj from 'share/preload/main'
import { invoke } from 'share/preload/util'

export default Object.assign(mainObj, {
  getDevices: invoke<IpcGetDevices>('getDevices'),
  getMainStore: invoke<IpcGetStore>('getMainStore'),
  setMainStore: invoke<IpcSetStore>('setMainStore'),
  getScreencastStore: invoke<IpcGetStore>('getScreencastStore'),
  setScreencastStore: invoke<IpcSetStore>('setScreencastStore'),
  getDevicesStore: invoke<IpcGetStore>('getDevicesStore'),
  setDevicesStore: invoke<IpcSetStore>('setDevicesStore'),
  setScreencastAlwaysOnTop: invoke<IpcSetScreencastAlwaysOnTop>(
    'setScreencastAlwaysOnTop'
  ),
  getSettingsStore: invoke<IpcGetStore>('getSettingsStore'),
  setSettingsStore: invoke<IpcSetStore>('setSettingsStore'),
  showScreencast: invoke('showScreencast'),
  closeScreencast: invoke('closeScreencast'),
  restartScreencast: invoke('restartScreencast'),
  showDevices: invoke('showDevices'),
  getOverview: invoke('getOverview'),
  setFontScale: invoke('setFontScale'),
  getPerformance: invoke('getPerformance'),
  getUptime: invoke('getUptime'),
  getFps: invoke<IpcGetFps>('getFps'),
  createShell: invoke<IpcCreateShell>('createShell'),
  writeShell: invoke<IpcWriteShell>('writeShell'),
  resizeShell: invoke<IpcResizeShell>('resizeShell'),
  killShell: invoke<IpcKillShell>('killShell'),
  screencap: invoke<IpcScreencap>('screencap'),
  openLogcat: invoke<IpcOpenLogcat>('openLogcat'),
  closeLogcat: invoke<IpcCloseLogcat>('closeLogcat'),
  pauseLogcat: invoke<IpcPauseLogcat>('pauseLogcat'),
  resumeLogcat: invoke<IpcResumeLogcat>('resumeLogcat'),
  getProcesses: invoke<IpcGetProcesses>('getProcesses'),
  getWebviews: invoke<IpcGetWebviews>('getWebviews'),
  getTopPackage: invoke<IpcGetTopPackage>('getTopPackage'),
  stopPackage: invoke<IpcStopPackage>('stopPackage'),
  clearPackage: invoke<IpcClearPackage>('clearPackage'),
  startPackage: invoke<IpcStartPackage>('startPackage'),
  installPackage: invoke<IpcInstallPackage>('installPackage'),
  uninstallPackage: invoke<IpcUninstallPackage>('uninstallPackage'),
  getPackages: invoke<IpcGetPackages>('getPackages'),
  getPackageInfos: invoke<IpcGetPackageInfos>('getPackageInfos'),
  disablePackage: invoke<IpcDisablePackage>('disablePackage'),
  enablePackage: invoke<IpcEnablePackage>('enablePackage'),
  pullFile: invoke<IpcPullFile>('pullFile'),
  pushFile: invoke<IpcPushFile>('pushFile'),
  openFile: invoke<IpcOpenFile>('openFile'),
  deleteFile: invoke<IpcDeleteFile>('deleteFile'),
  deleteDir: invoke<IpcDeleteDir>('deleteDir'),
  createDir: invoke<IpcCreateDir>('createDir'),
  readDir: invoke<IpcReadDir>('readDir'),
  statFile: invoke<IpcStatFile>('statFile'),
  moveFile: invoke<IpcMoveFile>('moveFile'),
  connectDevice: invoke<IpcConnectDevice>('connectDevice'),
  disconnectDevice: invoke<IpcDisconnectDevice>('disconnectDevice'),
  startScrcpy: invoke<IpcStartScrcpy>('startScrcpy'),
  reverseTcp: invoke<IpcReverseTcp>('reverseTcp'),
  inputKey: invoke<IpcInputKey>('inputKey'),
  listForwards: invoke<IpcListForwards>('listForwards'),
  listReverses: invoke<IpcListReverses>('listReverses'),
  forward: invoke<IpcForward>('forward'),
  reverse: invoke<IpcReverse>('reverse'),
  startWireless: invoke('startWireless'),
  openAdbCli: invoke('openAdbCli'),
  dumpWindowHierarchy: invoke<IpcDumpWindowHierarchy>('dumpWindowHierarchy'),
  root: invoke('root'),
  getAvds: invoke<IpcGetAvds>('getAvds'),
  startAvd: invoke<IpcStartAvd>('startAvd'),
  stopAvd: invoke<IpcStopAvd>('stopAvd'),
  wipeAvdData: invoke<IpcWipeAvdData>('wipeAvdData'),
  restartAdbServer: invoke('restartAdbServer'),
  pairDevice: invoke<IpcPairDevice>('pairDevice'),
  getFileUrl: invoke<IpcGetFileUrl>('getFileUrl'),
})
